import Router from 'koa-router';
const router = new Router();
import proxyService from '../../common/proxyService';
import {
  uploadCloudToken,
  getUserInfo,
  getShareParam,
  getFormDetail,
  getFormInfo,
  saveFormStatistic,
  saveFormUserInfo,
  getFissionDetail,
  saveFissonStatistic,
  saveFormShareStatistic,
  getTemplateInfo,
  getH5FormInfo,
  getSubscribeDetail,
  saveFissionRelation,
  saveComplaint,
  getComplaintUrl,
} from '../../api/form';
// 获取
router.post('/uploadCloudToken', async ctx => {
  const response = await proxyService.postProxy(ctx, uploadCloudToken);
  return (ctx.body = response);
});

router.post('/getUserInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getUserInfo);
  return (ctx.body = response);
});

router.post('/getShareParam', async ctx => {
  const response = await proxyService.postProxy(ctx, getShareParam);
  return (ctx.body = response);
});

router.post('/getFormDetail', async ctx => {
  const response = await proxyService.postProxy(ctx, getFormDetail);
  return (ctx.body = response);
});

router.get('/getFormInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getFormInfo);
  return (ctx.body = response);
});

router.get('/getTemplateInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getTemplateInfo);
  return (ctx.body = response);
});

router.get('/getH5FormInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getH5FormInfo);
  return (ctx.body = response);
});

router.post('/saveFormStatistic', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFormStatistic);
  return (ctx.body = response);
});

router.post('/saveFormUserInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFormUserInfo);
  return (ctx.body = response);
});

router.post('/getFissionDetail', async ctx => {
  const response = await proxyService.postProxy(ctx, getFissionDetail);
  return (ctx.body = response);
});

router.post('/saveFissonStatistic', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFissonStatistic);
  return (ctx.body = response);
});

router.post('/saveFormShareStatistic', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFormShareStatistic);
  return (ctx.body = response);
});

router.post('/getSubscribeDetail', async ctx => {
  const response = await proxyService.postProxy(ctx, getSubscribeDetail);
  return (ctx.body = response);
});

router.post('/saveFissionRelation', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFissionRelation);
  return (ctx.body = response);
});

router.post('/saveComplaint', async ctx => {
  const response = await proxyService.postProxy(ctx, saveComplaint);
  return (ctx.body = response);
});

router.post('/getComplaintUrl', async ctx => {
  const response = await proxyService.postProxy(ctx, getComplaintUrl);
  return (ctx.body = response);
});

module.exports = router;
